package com.misboot.document.client;

import com.misboot.document.client.fallbackFactory.SystemClientFallbackFactory;
import com.misboot.document.config.FeignConfig;
import com.misboot.document.constants.FeignClientName;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @MethodName
 * @Description   调用misboot-message相关接口
 * @Description   本地开发时可以指定 ip+网关端口进行访问  在configuration中配置 url = "http://192.168.1.104:9774/system"
 * @Param null
 * @Return
 * @Author 湖南佐佑时代科技有限公司<service@zuoyo.com>
 * @Date 2019-11-23 14:37
 */
@FeignClient(name = FeignClientName.SYSTEM_SERVER_NAME, configuration = FeignConfig.class,
        fallbackFactory = SystemClientFallbackFactory.class
)
public interface SystemClient {


    /**
     * @Description   获取数据权限数据
     * @Param
     * @Return List<Map<String, Object>>
     * @Author 湖南佐佑时代科技有限公司<service@zuoyo.com>
     * @Date 2019-6-7 15:48
     */
    @RequestMapping(value = "/sysAuthdataFilter/getListByApiUuid", method = RequestMethod.GET)
    List<Map<String, Object>> getFilterListByApiUuid(@RequestParam("apiUuid") String apiUuid);


    /** 解析Excel文件内容返回map
     * @MethodName analysisExecl
     * @Description
     * @Param address
     * @Return java.util.Map
     * @Author 朱永敬<zhuyongjing@zuoyour.com>
     * @Date 2019-09-26 12:07
     */
    @RequestMapping(value = "/attachment/analysisExecl")
    List<Map<String,Object>> analysisExecl(@RequestParam("address") String address);


    /**
     * @Description   获取数据权限数据
     * @Param
     * @Return List<Map<String, Object>>
     * @Author 湖南佐佑时代科技有限公司<service@zuoyo.com>
     * @Date 2019-6-7 15:48
     */
    @RequestMapping(value = "/sysDataAuth/getDataAuthList", method = RequestMethod.POST)
    List<Map<String, Object>>  getDataAuthList();


    /**
     * @Description   获取常用配置
     * @Param type   {weixin,mail,app,dingding,login,fileUpload,message}
     * @Return java.util.Map<java.lang.String, java.lang.Object>
     * @Author 湖南佐佑时代科技有限公司<service@zuoyo.com>
     * @Date 2019-6-7 15:48
     */
    @RequestMapping(value = "/sysConfiguration/getSysConfigurationDetailByType", method = RequestMethod.POST)
    Map<String, Object> getSysConfigurationDetailByType(@RequestParam("type") String type);


    /**
     * 保存日志数据
     *
     * @param map
     * @return Object
     */
    @PostMapping(value = "/sysOperationLog/save")
    Object save(@RequestParam Map<String, Object> map);

    /**
     * 保存日志数据 此接口被放开拦截
     *
     * @param map map
     * @return {@link Object}
     */
    @PostMapping(value = "/sysOperationLog/save.api")
    Object saveapi(@RequestParam Map<String, Object> map);

    /**
     * 查询权限数据规则
     *
     * @param component 组件
     * @return {@link String}
     */
    @ResponseBody
    @PostMapping(value = "/sysDataPermission/queryPermissionDataRule")
    String queryPermissionDataRule(@RequestParam("component")String component);

    @ResponseBody
    @RequestMapping(value = "/sysUser/getUserByUserNameId", method = RequestMethod.POST)
    Object getUserByUserNameId(@RequestParam("userNameId") String userNameId);
}
